<?php
   //OCP\JSON::callCheck();
   $val = JRequest::getInt('val', 0);
   // update session to hide the advanced search
   $app = PFactory::getApplication();
   $jobpistiondir = $app->getUserState('jobpositiondir', null);
   if ($jobpistiondir) {
      $jobpistiondir['switchsearch'] = $val;
   } else {
      $jobpistiondir = array('switchsearch' => $val);
   }
   $app->setUserState('jobpositiondir', $jobpistiondir);
   OCP\JSON::success();